package character;

import com.jme3.export.InputCapsule;
import com.jme3.export.JmeExporter;
import com.jme3.export.JmeImporter;
import com.jme3.export.OutputCapsule;
import com.jme3.export.Savable;
import com.jme3.math.Vector3f;
import java.io.IOException;
import mygame.DefaultValues;

/** This class holds volatile data for a character that may change often. */
public class CharacterStatus implements Savable {
    protected Vector3f moveDir;
    protected float moveSpeed;

    public Vector3f getMoveDir() {
	return moveDir;
    }

    public void setMoveDir(Vector3f moveDir) {
	this.moveDir = moveDir;
    }

    public float getMoveSpeed() {
	return moveSpeed;
    }

    public void setMoveSpeed(float moveSpeed) {
	this.moveSpeed = moveSpeed;
    }

    public void write(JmeExporter ex) throws IOException {
	OutputCapsule capsule = ex.getCapsule(this);
	capsule.write(moveDir, "moveDir", new Vector3f());
	capsule.write(moveSpeed, "moveSpeed", DefaultValues.CHARACTER_SETTING_WALK_SPEED);
    }

    public void read(JmeImporter im) throws IOException {
	InputCapsule capsule = im.getCapsule(this);
	moveDir = (Vector3f)capsule.readSavable("moveDir", new Vector3f());
	moveSpeed = capsule.readFloat("moveSpeed", DefaultValues.CHARACTER_SETTING_WALK_SPEED);
    }
}
